package com.yan.springcloud.controller;

import com.netflix.discovery.converters.Auto;
import com.yan.springcloud.pojo.Dept;
import com.yan.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author ：Yan Guang
 * @date ：Created in 2020/11/28 17:54
 * @description：
 */
@RestController
public class DeptConsumerController {

    @Autowired
    private DeptClientService deptClientService=null;

    @GetMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") long id){
        return this.deptClientService.queryById(id);
    }

    @PostMapping("/consumer/dept/add")
    public boolean add(Dept dept){
        return this.deptClientService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/all")
    public List<Dept> query(){
        return this.deptClientService.queryAll();
    }
}
